﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Gonte.Data;

namespace Gonte.Desktop.DataAccess
{
    public interface IObjectService
    {
        /// <summary>
        /// Retrieves the types supported
        /// </summary>
        /// <returns></returns>
        IEnumerable<string> GetTypes();

        /// <summary>
        /// Retrieves the type from the typename
        /// </summary>
        /// <param name="typeName"></param>
        /// <returns></returns>
        Type GetType(string typeName);

        /// <summary>
        /// Retrieves the collection of objects
        /// </summary>
        /// <param name="typeName"></param>
        /// <param name="filter"></param>
        /// <returns></returns>
        IList<object> GetCollection(string typeName, DataFilter filter);

        /// <summary>
        /// Retrieves the object
        /// </summary>
        /// <param name="typName"></param>
        /// <param name="id"></param>
        /// <returns></returns>
        object Get(string typeName, object id);

        /// <summary>
        /// Inserts the object
        /// </summary>
        /// <param name="typeName"></param>
        /// <param name="criteria"></param>
        /// <returns></returns>
        object Insert(string typeName, object obj);

        /// <summary>
        /// Updates the object
        /// </summary>
        /// <param name="typeName"></param>
        /// <param name="obj"></param>
        void Update(string typeName, object obj);

        /// <summary>
        /// Deletes the object by its id
        /// </summary>
        /// <param name="typeName"></param>
        /// <param name="criteria"></param>
        void Delete(string typeName, object id);
    }
}
